#!/bin/bash

exec_times=1

values=(
    $(seq 1195 1 1210)
    $(seq 1210 10 1300)
    $(seq 1300 50 1800)
    $(seq 1800 250 3000)
)

f="data_ex"
data_plot="data_plot"

make all >/dev/null

rm $f*

for e in $(seq $exec_times)
do
    fe=$f$e

    echo -n "" > $fe

    for i in ${values[@]}
    do
        echo -ne "$i\t"               
        ./simu `echo "$i*1024*1024/1000" | bc` 2>/dev/null | tail -n 1 >> $fe &
    done

    if (( $e % 10 == 0 ))
    then
        sleep 5
    fi

done

#sleep 15

for e in $(seq $exec_times)
do
    fe=$f$e

    sort -n $fe > $fe"_tmp"
    mv $fe"_tmp" $fe

done

#./stat $f $exec_times ${#values[@]} > $data_plot

./plot

#eog utilizacao_fila.png